home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / opengl / siggraphCD / lib / libaux / aux.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  7.6 KB  |  287 lines

  1. /*
  2.  * (c) Copyright 1993, 1994, Silicon Graphics, Inc.
  3.  * ALL RIGHTS RESERVED 
  4.  * Permission to use, copy, modify, and distribute this software for 
  5.  * any purpose and without fee is hereby granted, provided that the above
  6.  * copyright notice appear in all copies and that both the copyright notice
  7.  * and this permission notice appear in supporting documentation, and that 
  8.  * the name of Silicon Graphics, Inc. not be used in advertising
  9.  * or publicity pertaining to distribution of the software without specific,
  10.  * written prior permission. 
  11.  *
  12.  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
  13.  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
  14.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
  15.  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
  16.  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
  17.  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
  18.  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
  19.  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
  20.  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
  21.  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
  22.  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
  23.  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
  24.  * 
  25.  * US Government Users Restricted Rights 
  26.  * Use, duplication, or disclosure by the Government is subject to
  27.  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
  28.  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
  29.  * clause at DFARS 252.227-7013 and/or in similar or successor
  30.  * clauses in the FAR or the DOD or NASA FAR Supplement.
  31.  * Unpublished-- rights reserved under the copyright laws of the
  32.  * United States.  Contractor/manufacturer is Silicon Graphics,
  33.  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
  34.  *
  35.  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
  36.  */
  37. #ifndef __aux_h__
  38. #define __aux_h__
  39.  
  40. #include <X11/Xlib.h>
  41. #include <X11/Xutil.h>
  42. #include <GL/gl.h>
  43. #include <GL/glu.h>
  44.  
  45. /*
  46. ** ToolKit Window Types
  47. ** In the future, AUX_RGBA may be a combination of both RGB and ALPHA
  48. */
  49.  
  50. #define AUX_RGB        0
  51. #define AUX_RGBA    AUX_RGB
  52. #define AUX_INDEX    1
  53. #define AUX_SINGLE    0
  54. #define AUX_DOUBLE    2
  55. #define AUX_DIRECT    0
  56. #define AUX_INDIRECT    4
  57.  
  58. #define AUX_ACCUM    8
  59. #define AUX_ALPHA    16
  60. #define AUX_DEPTH    32
  61. #define AUX_STENCIL    64
  62. #define AUX_AUX        128
  63.  
  64. /* 
  65. ** Window Masks
  66. */
  67.  
  68. #define AUX_WIND_IS_RGB(x)    (((x) & AUX_INDEX) == 0)
  69. #define AUX_WIND_IS_INDEX(x)    (((x) & AUX_INDEX) != 0)
  70. #define AUX_WIND_IS_SINGLE(x)    (((x) & AUX_DOUBLE) == 0)
  71. #define AUX_WIND_IS_DOUBLE(x)    (((x) & AUX_DOUBLE) != 0)
  72. #define AUX_WIND_IS_INDIRECT(x)    (((x) & AUX_INDIRECT) != 0)
  73. #define AUX_WIND_IS_DIRECT(x)    (((x) & AUX_INDIRECT) == 0)
  74. #define AUX_WIND_HAS_ACCUM(x)    (((x) & AUX_ACCUM) != 0)
  75. #define AUX_WIND_HAS_ALPHA(x)    (((x) & AUX_ALPHA) != 0)
  76. #define AUX_WIND_HAS_DEPTH(x)    (((x) & AUX_DEPTH) != 0)
  77. #define AUX_WIND_HAS_STENCIL(x)    (((x) & AUX_STENCIL) != 0)
  78.  
  79. /*
  80. ** ToolKit Event Structure
  81. */
  82.  
  83. typedef struct _AUX_EVENTREC {
  84.     GLint event;
  85.     GLint data[4];
  86. } AUX_EVENTREC;
  87.  
  88. /* 
  89. ** ToolKit Event Types
  90. */
  91. #define AUX_EXPOSE    1
  92. #define AUX_CONFIG    2
  93. #define AUX_DRAW    4
  94. #define AUX_KEYEVENT    8
  95. #define AUX_MOUSEDOWN    16
  96. #define AUX_MOUSEUP    32    
  97. #define AUX_MOUSELOC    64
  98.  
  99. /*
  100. ** Toolkit Event Data Indices
  101. */
  102. #define AUX_WINDOWX        0
  103. #define AUX_WINDOWY        1
  104. #define AUX_MOUSEX        0
  105. #define AUX_MOUSEY        1
  106. #define AUX_MOUSESTATUS        3
  107. #define AUX_KEY            0
  108. #define AUX_KEYSTATUS        1
  109.  
  110. /*
  111. ** ToolKit Event Status Messages
  112. */
  113. #define    AUX_LEFTBUTTON        1
  114. #define    AUX_RIGHTBUTTON        2
  115. #define    AUX_MIDDLEBUTTON    4
  116. #define    AUX_SHIFT        1
  117. #define    AUX_CONTROL        2
  118.  
  119. /* 
  120. ** ToolKit Key Codes
  121. */
  122. #define AUX_RETURN        0x0D
  123. #define AUX_ESCAPE        0x1B
  124. #define AUX_SPACE        0x20
  125. #define AUX_LEFT        0x25
  126. #define AUX_UP            0x26
  127. #define AUX_RIGHT        0x27
  128. #define AUX_DOWN        0x28
  129. #define AUX_A            'A'
  130. #define AUX_B            'B'
  131. #define AUX_C            'C'
  132. #define AUX_D            'D'
  133. #define AUX_E            'E'
  134. #define AUX_F            'F'
  135. #define AUX_G            'G'
  136. #define AUX_H            'H'
  137. #define AUX_I            'I'
  138. #define AUX_J            'J'
  139. #define AUX_K            'K'
  140. #define AUX_L            'L'
  141. #define AUX_M            'M'
  142. #define AUX_N            'N'
  143. #define AUX_O            'O'
  144. #define AUX_P            'P'
  145. #define AUX_Q            'Q'
  146. #define AUX_R            'R'
  147. #define AUX_S            'S'
  148. #define AUX_T            'T'
  149. #define AUX_U            'U'
  150. #define AUX_V            'V'
  151. #define AUX_W            'W'
  152. #define AUX_X            'X'
  153. #define AUX_Y            'Y'
  154. #define AUX_Z            'Z'
  155. #define AUX_a            'a'
  156. #define AUX_b            'b'
  157. #define AUX_c            'c'
  158. #define AUX_d            'd'
  159. #define AUX_e            'e'
  160. #define AUX_f            'f'
  161. #define AUX_g            'g'
  162. #define AUX_h            'h'
  163. #define AUX_i            'i'
  164. #define AUX_j            'j'
  165. #define AUX_k            'k'
  166. #define AUX_l            'l'
  167. #define AUX_m            'm'
  168. #define AUX_n            'n'
  169. #define AUX_o            'o'
  170. #define AUX_p            'p'
  171. #define AUX_q            'q'
  172. #define AUX_r            'r'
  173. #define AUX_s            's'
  174. #define AUX_t            't'
  175. #define AUX_u            'u'
  176. #define AUX_v            'v'
  177. #define AUX_w            'w'
  178. #define AUX_x            'x'
  179. #define AUX_y            'y'
  180. #define AUX_z            'z'
  181. #define AUX_0            '0'
  182. #define AUX_1            '1'
  183. #define AUX_2            '2'
  184. #define AUX_3            '3'
  185. #define AUX_4            '4'
  186. #define AUX_5            '5'
  187. #define AUX_6            '6'
  188. #define AUX_7            '7'
  189. #define AUX_8            '8'
  190. #define AUX_9            '9'
  191.  
  192. /*
  193. ** ToolKit Gets and Sets
  194. */
  195. #define AUX_FD            1  /* return fd (long) */
  196. #define AUX_COLORMAP        3  /* pass buf of r, g and b (unsigned char) */
  197. #define AUX_GREYSCALEMAP    4
  198. #define AUX_FOGMAP        5  /* pass fog and color bits (long) */
  199. #define AUX_ONECOLOR        6  /* pass index, r, g, and b (long) */
  200.  
  201. /*
  202. ** Color Macros
  203. */
  204.  
  205. enum {
  206.     AUX_BLACK = 0,
  207.     AUX_RED,
  208.     AUX_GREEN,
  209.     AUX_YELLOW,
  210.     AUX_BLUE,
  211.     AUX_MAGENTA,
  212.     AUX_CYAN,
  213.     AUX_WHITE
  214. };
  215.  
  216. extern float auxRGBMap[8][3];
  217.  
  218. #define AUX_SETCOLOR(x, y) (AUX_WIND_IS_RGB((x)) ? \
  219.                    glColor3fv(auxRGBMap[(y)]) : glIndexf((y)))
  220.  
  221. /*
  222. ** RGB Image Structure
  223. */
  224.  
  225. typedef struct _AUX_RGBImageRec {
  226.     GLint sizeX, sizeY;
  227.     unsigned char *data;
  228. } AUX_RGBImageRec;
  229.  
  230. /*
  231. ** Prototypes
  232. */
  233.  
  234. extern void auxInitDisplayMode(GLenum);
  235. extern void auxInitPosition(int, int, int, int);
  236. extern GLenum auxInitWindow(char *);
  237. extern void auxCloseWindow(void);
  238. extern void auxQuit(void);
  239. extern void auxSwapBuffers(void);
  240.  
  241. extern Display *auxXDisplay(GLvoid);
  242. extern Window auxXWindow(GLvoid);
  243.  
  244. extern void auxMainLoop(void (*)());
  245. extern void auxExposeFunc(void (*)(int, int));
  246. extern void auxReshapeFunc(void (*)(int, int));
  247. extern void auxIdleFunc(void (*)());
  248. extern void auxKeyFunc(int, void (*)());
  249. extern void auxMouseFunc(int, int, void (*)(AUX_EVENTREC *));
  250.  
  251. extern int auxGetColorMapSize(void);
  252. extern void auxGetMouseLoc(int *, int *);
  253. extern void auxSetOneColor(int, float, float, float);
  254. extern void auxSetFogRamp(int, int);
  255. extern void auxSetGreyRamp(void);
  256. extern void auxSetRGBMap(int, float *);
  257.  
  258. extern AUX_RGBImageRec *auxRGBImageLoad(char *);
  259.  
  260. extern void auxCreateFont(void);
  261. extern void auxDrawStr(char *);
  262.  
  263. extern void auxWireSphere(GLdouble);
  264. extern void auxSolidSphere(GLdouble);
  265. extern void auxWireCube(GLdouble);
  266. extern void auxSolidCube(GLdouble);
  267. extern void auxWireBox(GLdouble, GLdouble, GLdouble);
  268. extern void auxSolidBox(GLdouble, GLdouble, GLdouble);
  269. extern void auxWireTorus(GLdouble, GLdouble);
  270. extern void auxSolidTorus(GLdouble, GLdouble);
  271. extern void auxWireCylinder(GLdouble, GLdouble);
  272. extern void auxSolidCylinder(GLdouble, GLdouble);
  273. extern void auxWireIcosahedron(GLdouble);
  274. extern void auxSolidIcosahedron(GLdouble);
  275. extern void auxWireOctahedron(GLdouble);
  276. extern void auxSolidOctahedron(GLdouble);
  277. extern void auxWireTetrahedron(GLdouble);
  278. extern void auxSolidTetrahedron(GLdouble);
  279. extern void auxWireDodecahedron(GLdouble);
  280. extern void auxSolidDodecahedron(GLdouble);
  281. extern void auxWireCone(GLdouble, GLdouble);
  282. extern void auxSolidCone(GLdouble, GLdouble);
  283. extern void auxWireTeapot(GLdouble);
  284. extern void auxSolidTeapot(GLdouble);
  285.  
  286. #endif /* __aux_h__ */
  287.